/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.viettel.bkno.visionone.entities;

/**
 *
 * @author hien
 */
public enum Role {
    ADMIN (1,"Admin"),
    SUB_ADMIN (2, "Sub admin"),
    NORMAL_USER (3, "Normal user");
    
    int code;
    String name;

    private Role(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static Role getRole(int code) {
        switch (code) {
            case 1:
                return ADMIN;
            case 2:
                return SUB_ADMIN;
            case 3:
                return NORMAL_USER;
            default: 
                return NORMAL_USER;
        }
    }
}
